package com.zzl.bonds.ticket.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.zzl.bonds.ticket.constant.TicketBookRelationTypeEnum;
import com.zzl.bonds.ticket.dto.bookrelation.TicketBookRelationAddDto;
import com.zzl.bonds.ticket.dto.bookrelation.TicketBookRelationBatchAddDto;
import com.zzl.bonds.ticket.dto.bookrelation.TicketBookRelationUpdateDto;
import com.zzl.bonds.ticket.entity.TicketBookRelationEntity;
import com.zzl.general.common.exception.SysException;
import com.zzl.general.common.serurity.entity.User;
import com.zzl.general.common.utils.PageUtils;

import java.util.List;
import java.util.Map;

/**
 * 联系人票关系表
 *
 * @author gull
 * @date 2021-12-07 16:29:41
 */
@SuppressWarnings("javadoc")
public interface TicketBookRelationService extends IService<TicketBookRelationEntity> {

    /**
     * 分页查询
     *
     * @param params 查询参数
     * @return 分页数据
     */
    PageUtils queryPage(Map<String, Object> params);

    /**
     * 新增
     *
     * @param tickebookRelationAddDto 新增实体
     * @param user                    当前登录用户
     * @throws SysException 业务异常
     */
    void saveTickebookRelation(TicketBookRelationAddDto tickebookRelationAddDto, User user) throws SysException;

    /**
     * 修改
     *
     * @param tickebookRelationUpdateDto 修改实体
     * @param user                       当前登录用户
     * @throws SysException 业务异常
     */
    void updateTickebookRelationById(TicketBookRelationUpdateDto tickebookRelationUpdateDto, User user) throws SysException;

    /**
     * 发送消息，保存发送消息的信息
     *
     * @param tickebookRelation 发消息和开立申请关系
     * @param user              登录用户
     */
    void saveTicketBookRelationBatch(TicketBookRelationBatchAddDto tickebookRelation, User user) throws SysException;

    /**
     * 通讯录发消息处理
     * @param objId 申请id
     */
    void ticketBookSendMsgToMq(String objId, List<Integer> type, User user) throws SysException;

    /**
     * 审批成功后发送消息给外部联系人
     *
     * @param ticket   票据对象
     * @param typeEnum 业务类型枚举
     * @throws SysException 业务异常，可能因为ticket没有getId方法而抛出
     */
    void ticketBookSendMessage(Object ticket, TicketBookRelationTypeEnum typeEnum) throws SysException;


}

